import java.util.HashSet;
import java.util.Set;

/**
 * @author LKQ
 * @date 2022/2/15 15:37
 * @description 深度优先遍历
 */
public class Solution {
    Set<Integer> set = new HashSet<>();
    public int numColor(TreeNode root) {
       if (root == null) {
           return 0;
       }
       set.add(root.val);
       numColor(root.left);
       numColor(root.right);
       return set.size();
    }
}

